import request from "@/request/request.ts";

/* 获取订单详情的接口 */
export const fetchOrderInfoAPI = (id: string) => {
    return request({
        url: `/order/orderInfo/auth/getOrderInfo/${id}`,
        method: "GET"
    })
}

/* 取消预约的接口 */
export const cancelOrderAPI = (id: string) => {
    return request({
        url: `/order/orderInfo/auth/cancelOrder/${id}`,
        method: "GET"
    })
}

/* 获取支付订单二维码的接口 */
export const createNativeAPI = (id: string) => {
    return request({
        url: `/order/weixin/createNative/${id}`
    })
}

/* 查询订单的支付状态 */
export const queryPayStatusAPI = (id: string) => {
    return request({
        url: `/order/weixin/queryPayStatus/${id}`,
        method: "GET"
    })
}

/* 获取账号用户信息的接口 */
export const fetchUserInfoAPI = () => {
    return request({
        url: "/user/auth/getUserInfo",
        method: "GET"
    })
}

/* 获取证件类型的接口 */
export const findByDictCodeAPI = (dictCode: string) => {
    return request({
        url: `/cmn/dict/findByDictCode/${dictCode}`,
        method: "GET"
    })
}

/* 用户实名认证的接口 */
export const userCertationAPI = (data) => {
    return request({
        url: "/user/auth/userAuah",
        method: "POST",
        data
    })
}

/*  获取订单列表的接口 */
export const fetchOrderListAPI = (params) => {
    return request({
        url: `/order/orderInfo/auth/${params.page}/${params.limit}`,
        method: "GET",
        params
    })
}

/* 获取索所有就诊人的接口 */
export const fetchPersonListAPI = () => {
    return request({
        url: "/user/patient/auth/findAll",
        method: "GET"
    })
}

/* 获取索所有订单状态的接口 */
export const fetchOrderStatusListAPI = () => {
    return request({
        url: "/order/orderInfo/auth/getStatusList",
        method: "GET"
    })
}

/*获取所有城市的接口 */
export const fetchDictListAPI = (parentId) => {
    return request({
        url: `/cmn/dict/findByParentId/${parentId}`,
        method: "GET"
    })
}

/* 删除就诊人的接口 */
export const deletePatAPI = (id) => {
    return request({
        url: `/user/patient/auth/remove/${id}`,
        method: "DELETE"
    })
}


/* 添加或者修改就诊人的接口 */
export const addOrEditPatAPI = (data) => {
    if (data.id) {
        return request({
            url: "/user/patient/auth/update",
            method: "PUT",
            data
        })
    } else {
        return request({
            url: "/user/patient/auth/save",
            method: "POST",
            data
        })
    }
}
